<!--
 * @Description: 
 * @Author: charles
 * @Date: 2021-05-05 22:02:56
 * @LastEditors: liuyq
 * @LastEditTime: 2021-09-22 18:03:40
-->
<template>
  <div ref="root" style="height:130px">
    
  </div>
</template>

<script>
import { Rose } from "@antv/g2plot";
import { ref, onMounted } from 'vue';
export default {
  setup() {
    let root = ref(null);
    let rose = null;
    const data = [
      { type: "分类一", value: 27 },
      { type: "分类二", value: 25 },
      { type: "分类三", value: 18 },
      { type: "分类四", value: 15 },
      { type: "分类五", value: 10 },
      { type: "其他", value: 5 },
    ];
    let initCharts = () => {
      rose = new Rose(root.value, {
        data,
        xField: "type",
        yField: "value",
        seriesField: "type",
        radius: 0.9,
        label: {
          offset: -15,
        },
      });
      rose.render();
    };
    onMounted(initCharts);
    return {
      root
    }
  },
};
</script>